#pragma once
#include <iostream>
#include <vector>
#include <curl/curl.h>
#include <CIckdXml.h>
#include "CStringTransform.h"

using namespace std;
class CHttpRequest
{
public:
	CHttpRequest(void);
	~CHttpRequest(void);
	void SearchSimple(const CString &number = _T(""));
	//vector<listRequset > SearchDetail(const CString &number = _T(""));

	void Test();

	void SetHttpParam(  const CString &company = _T("aae"),
						const CString &number  = _T("123456"),
						const CString &key     = _T("E232DC317A582FA7BFBFE6CE2AF8E282"));

	bool ResetHttpRequsetKey();

	void SetParentDlg(LPVOID params)
	{
		m_parenDlg = params;
	}
	CString GetNumber()
	{
		return m_Num;
	};
	CString GetCompany()
	{
		return m_Company;
	}
private:
	void InitHttpRequset(   const CString &company = _T("aae"),
							const CString &number  = _T("123456"),
							const CString &key     = _T("E232DC317A582FA7BFBFE6CE2AF8E282"));

	static CHttpRequest *m_CHttpRequest;

	CString m_Company;
	CString m_Num;
	CString m_Key;
	CString m_RequsetUrl;

	vector<CListDataItem > m_RequsetData;

	CIckdXml m_xmler;
	CStringTransform m_Trans;

	LPVOID m_parenDlg;
public:
	static CHttpRequest *GetHttpRequester();
	static string GBKToUTF8(const std::string& strGBK)  ;
	static string UTF8ToGBK(const std::string& strUTF8)  ;
};
